A standard way to communicate between two processes 1 and 2 (running on the same machine or running on different machines) is to send a message, via, e.g., an interprocess communication (IPC) mechanism. Often, for example, it is desirable to enable process 1 to send a message to process 2 asking process 2 to execute code on behalf of process 1. Typically, process 1 must have knowledge of a port or contact point for process 2 in order to do this.
The procedure of transforming the function call into a message is called marshalling. Marshalling converts what the code in process a sees as a function call into 1 message to be sent to process 2. The message must contain the name of the function and a set of parameters, coded in a way that process 2 understands. Process 2 receives the message and has to transform the message into a call to process 2's internal function. The process of converting a message into a function call is called unmarshalling. The piece of code that performs marshalling in process 1 is called a proxy and typically resides in the client process. The corresponding piece of code on the server side that performs unmarshalling is called a stub.
In the process of marshalling and unmarshalling, many copies of a message are made at various stages of the communication of the message. These copies, especially of large messages, consume large amounts of memory and require a significant amount of time to transmit. This adversely affects performance.
Referring to FIG. 1, in a conventional system, in order for process 1 to send a message to process 2, process 1 makes a first copy to a buffer 10. Thereafter, process 1 makes a system call to a kernel 14, which receives a second copy in a system buffer 12. The kernel 14 switches its context to process 2 and copies a third copy of the message into a buffer 20. Process 2 then copies a fourth copy the message into its memory space. Thus, for a message to be transmitted from process 1 to process 2 in a conventional system, at least four copies of a message are made. It would be advantageous to avoid making copies of messages and this process consumes CPU time and system memory.
A problem with conventional methods of communicating between two processes arises when the two processes do not trust each other. Typically a copy of the message is made by the receiving process to avoid problems that may occur if the send process should change the message, etc. This, disadvantageously, requires additional memory and overhead.
Thus, there is a need for system that overcomes the limitations of the prior art. The present invention provides such a solution.